<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>酷妈妈商城</title>
</head>
<body>
	<h1>商品列表</h1>
	<img alt="" src="/image/cart.bmp" onclick="location.href='/cart.jsp'">
	<c:if test="${empty products }">
		<h1>系统还没有添加任何商品！</h1>
	</c:if>
	<c:if test="${not empty products }">
		<c:forEach var="product" items="${products}">
			商品编号 ${product.id }<br />
			<h2>
			<input type="checkbox" name="getAll" id="getAll" value="${product.id }"/>
				<a
					href="<%=basePath %>ShowProductServlet?id=${product.id }">商品名称
					${product.name }</a>
			</h2>
			<h3>商品分类 ${product.category }</h3>
			
			<img src="<%=path %>/${product.img_s }"
				onclick="location.href='<%=basePath %>ShowProductServlet?id=${product.id }';"
				style="cursor: pointer;" />
			<br />
			<h3 style="color: red; font-weight: bold">价格 ： ${product.price }</h3>
			<hr />
		</c:forEach>
		<input type="button" value="全部加入购物车" onclick="getAll()"/>
	</c:if>
</body>
<script language="javascript">
function getAll(){
	var url="CartServlet2";
 	window.location = url;
}
</script>
</html>